# Importing Data
INDONESIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "S1:S264")

# Checking the Imported Data
View(INDONESIA)
# Creating Time Series Data
INDONESIA_ts <- ts(INDONESIA, start=c(1998,1), end=c(2018,12), frequency=12)
# Viewing and Checking the Created Time Series Data
INDONESIA_ts
sum(is.na(INDONESIA_ts))
library(forecast)
INDONESIA_ts <- tsclean(INDONESIA_ts)
INDONESIA_ts

# Identification: Plotting the Time Series Data
plot(INDONESIA_ts)

# Estimating the appropriate model
INDONESIA_ts_model <- auto.arima(INDONESIA_ts)
INDONESIA_ts_model

# Forecasting
options(max.print=1000000)
INDONESIA_ts_forecast <- forecast (INDONESIA_ts_model, level=c(95), h=364)
plot(INDONESIA_ts_forecast)
INDONESIA_ts_forecast             

# Exporting
write.table(INDONESIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/INDONESIA_TSA.csv", sep=",")
